/*
 * File Name     : @(#)AbstractBasePanel.java
 * Creation Date : Mar 5, 2009
 * Author        : Anirudh Vyas
 * 
 * Copyright 2009 Anirudh Vyas
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package hcis.ui.component.wicket.panel;

import java.io.Serializable;

import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 * Abstract base panel.
 * 
 * @author anirudh
 * @param <MODEL>
 *            model type.
 * @param <ID>
 *            id type.
 */
public abstract class AbstractBasePanel<MODEL extends IModel<ID>, ID extends Serializable> extends Panel {

	/**
	 * Default serial version UID.
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Model bound for panel.
	 */
	private MODEL model;

	/**
	 * header container section.
	 */
	private MarkupContainer headerContainer;

	/**
	 * Footer container section.
	 */
	private MarkupContainer footerContainer;

	/**
	 * Default panel constructor setting the id.
	 * 
	 * @param pId
	 *            id to set.
	 * @param pModel
	 *            boundModel to set.
	 */
	public AbstractBasePanel(final String pId, final MODEL pModel) {
		super(pId);
		setModel(pModel);
		init();
	}

	/**
	 * Gets the headerContainer.
	 * 
	 * @return the headerContainer to get.
	 */
	public final MarkupContainer getHeaderContainer() {
		return headerContainer;
	}

	/**
	 * Gets the footerContainer.
	 * 
	 * @return the footerContainer to get.
	 */
	public final MarkupContainer getFooterContainer() {
		return footerContainer;
	}

	/**
	 * Sets the headerContainer.
	 * 
	 * @param headerContainer
	 *            the headerContainer to set.
	 */
	public final void setHeaderContainer(final MarkupContainer headerContainer) {
		this.headerContainer = headerContainer;
	}

	/**
	 * Sets the footerContainer.
	 * 
	 * @param footerContainer
	 *            the footerContainer to set.
	 */
	public final void setFooterContainer(final MarkupContainer footerContainer) {
		this.footerContainer = footerContainer;
	}

	/**
	 * Override the method to customize the initialization for panel.
	 */
	public abstract void init();

	/**
	 * Gets the model.
	 * 
	 * @return the model to get.
	 */
	public final MODEL getModel() {
		return model;
	}

	/**
	 * Sets the model.
	 * 
	 * @param model
	 *            the model to set.
	 */
	public final void setModel(final MODEL model) {
		this.model = model;
	}
}
